﻿Imports DevComponents.DotNetBar.SuperGrid

Public Class CLICKGRIDCHECKBOX
    Dim connect As CONDB = CONDB.NewConnection()


    Public Sub clickChkboxUpdate(tableName As String, gridData As Boolean, fieldUpdate As String, whereField As String, whereValue As String)
        Try
            connect = CONDB.NewConnection()
            connect.BeginTrans()
            Dim Sql As String
            Sql = "UPDATE " & tableName & " SET "
            If gridData = True Then
                Sql += "`" & fieldUpdate & "`" & " = " & "1"
            Else
                Sql += "`" & fieldUpdate & "`" & " = " & "0"
            End If
            Sql += " WHERE " & "`" & whereField & "`" & " = " & "'" & whereValue & "'"
            'MsgBox(Sql)

            connect.ExecuteNonQuery(Sql)
            connect.CommitTrans()
        Catch ex As Exception
            connect.RollbackTrans()
            MsgBox(ex.ToString)
        End Try
        connect.Dispose()
    End Sub
End Class